<!-- 动态详情 -->
<template>
	<view class="page">
		<Recommendeds :status="1" @attentionShare="attentionShare" :item="item" @zan='zan'></Recommendeds>
		<view class="comments">
			<view class="count">
				{{item.commentNum}} 条评论
			</view>
			<view class="list">
				<Comments @changeshowe="change" :it="it" v-for="it in commentList.attentionReplyList.body" :key="it.userId"></Comments>
			</view>
		</view>
		<Evaluation :avatar="avatar" v-if="!showe" :status="0" @shuaxin="getList"></Evaluation>	
		<Evaluations :status="0" v-if="showe" @changeshowe="change2"></Evaluations>
	</view> 
</template>

<script>
	import Recommendeds from '@/components/recommended/recommendeds.vue'
	import Comments from '@/components/comments/comments.vue'
	import Evaluation from '@/components/evaluation/evaluation.vue'
	import Evaluations from '@/components/evaluation/evaluations.vue'
	export default {
		components:{
			Recommendeds,
			Comments,
			Evaluation,
			Evaluations
		},
		data() {
			return {
				item: {},
				it: {},
				items:{},
				list: [],
				showe:false,
				commentList: [],
				query: {
					attentionListId: 0,
				},
				avatar:'',
				shareId:''
				
			}
		},
		onLoad() {
			this.query.attentionListId = uni.getStorageSync('pageNum')
			this.getList()
			// console.log(this.query.attentionListId)
			
		},
		onShareAppMessage(res){
			 if (res.from === 'button') {// 来自页面内分享按钮
			      // let qurey={}
			      // qurey.attentionListId = this.shareId
			      // console.log(qurey)
			      // this.$post('/attentionList/attentionShareRecords',qurey)
				  setTimeout(this.share,500)
			    }
			return {
			      title: '我正在用山富职得找工作，快来和我一起吧！',
			      path: '/pages/circle/circle',
			    }
		
		},
		methods: {
			//请求列表
			async getList() {
				let {
					data,code
				} = await this.$get('/attentionList/attentionDetail',this.query)
				if(code == 200){
					console.log(data)
					this.item = data
					
					this.commentList = data
					this.avatar = data.dvatar
					
				
				}
				
			},
			async share(){
				let qurey={}
				qurey.attentionListId = this.shareId
				console.log(qurey)
				await this.$post('/attentionList/attentionShareRecords',qurey)
				
			},
			attentionShare(e){
				this.shareId = e
				console.log(this.shareId)
			},
			zan(){
				this.getList()
			},
			change(e){
				this.showe = e
				console.log(this.showe)
			},
			change2(e){
				this.showe = e
				this.getList()
			},
		}
	}
</script>

<style lang="scss">
.page{
	padding-bottom: calc(75rpx + env(safe-area-inset-bottom));
	.comments{
		padding: 30rpx;
		.count{
			font-weight: bold;
			color: #333333;
			font-size: 28rpx;
		}
		.list{
			
		}
	}
}
</style>
